<template>
<!--    项目立项-->
    <div>
        
        <a-card :bordered="false">
            
            <div class="title">项目立项表</div>
            
            <detail-list>
                <detail-list-item term="项目编号">{{p.project_number}}</detail-list-item>
                <detail-list-item term="申请年度">{{p.year}}</detail-list-item>
                <detail-list-item term="立项序号">{{p.serial_number}}</detail-list-item>
            </detail-list>
            <detail-list :col="1">
                <detail-list-item term="项目名称">{{p.name}}</detail-list-item>
            </detail-list>
            <a-divider style="margin-bottom: 32px"/>
            <detail-list>
                <detail-list-item term="行政区划" v-if="p.division">{{p.division[0]}}/{{p.division[1]}}/{{p.division[2]}}</detail-list-item>
                <detail-list-item term="临近线路">{{p.lines}}</detail-list-item>
                <detail-list-item term="临近车站">{{p.stations}}</detail-list-item>
            </detail-list>
            <detail-list>
                <detail-list-item term="土地级别">{{p.land_level}}</detail-list-item>
                <detail-list-item term="四至边界">{{p.around_border}}</detail-list-item>
            </detail-list>
            <detail-list>
                <detail-list-item term="项目总用地面积">{{p.project_area}}</detail-list-item>
                <detail-list-item term="基础设施配套程度">{{p.supporting_facilities}}</detail-list-item>
                <detail-list-item term="开发方式">{{p.development_method}}</detail-list-item>
            </detail-list>
            <detail-list>
                <detail-list-item term="开发类型">{{p.development_type}}</detail-list-item>
                <detail-list-item term="计划总投资">{{p.planned_total_investment}}</detail-list-item>
                <detail-list-item term="计划投资强度">{{p.planned_investment_strength}}</detail-list-item>
            </detail-list>
            <detail-list>
                <detail-list-item term="计划容积率">{{p.planned_volume_rate}}</detail-list-item>
                <detail-list-item term="计划办公生活比重">{{p.planned_proportion_of_office_life}}</detail-list-item>
                <detail-list-item term="计划建筑系数">{{p.planned_building_coefficient}}</detail-list-item>
                <detail-list-item term="计划绿地率">{{p.planned_green_rate}}</detail-list-item>
            </detail-list>
            <detail-list :col="1">
                <detail-list-item term="项目简要概况">{{p.project_description}}</detail-list-item>
            </detail-list>
            <a-divider style="margin-bottom: 32px"/>
            <detail-list>
                <detail-list-item term="审批阶段">{{p.approval_stage}}</detail-list-item>
                <detail-list-item term="开发项目审批文号">{{p.approval_docs_number}}</detail-list-item>
                <detail-list-item term="审批结果">{{p.approval_result}}</detail-list-item>
            </detail-list>
            <detail-list>
                <detail-list-item term="项目建设阶段">{{p.project_build_stage}}</detail-list-item>
                <detail-list-item term="建档日期">{{p.docs_creator_date}}</detail-list-item>
                <detail-list-item term="建档人员">{{p.docs_creator}}</detail-list-item>
            </detail-list>
            <a-divider style="margin-bottom: 32px"/>
            <detail-list :col="1">
                <detail-list-item term="项目文档">
                    <div v-for="(item,index) in p.files" :key="index" >
                        {{item.name}}
                        <a :href="item.url" :download="item.name">
                            下载
                        </a>
                    </div>
                </detail-list-item>
            </detail-list>
            
            
        </a-card>
        <!--         fixed footer toolbar -->
    
    </div>
</template>

<script>
    
    import indexedDB from '@/db/db'
    import DetailList from '@/components/tools/DetailList'
    
    const DetailListItem = DetailList.Item
    export default {
        name: "ProjectApproval",
        components: {
            DetailList,
            DetailListItem
        },
        data() {
            return {
                p:[],

            }
        },
        mounted() {
            let id = this.$route.query.objId
            
            this.getProjectDetail(parseInt(id))
            
        },
        methods: {
            getProjectDetail(id){
                indexedDB.get({name:'project'}, id).then(res=>{
                    // console.log(res)
                    this.p = res[0]
                    this.p.files.forEach((item,index)=>{
                        this.p.files[index].url = URL.createObjectURL(item.originFileObj)
                    })
                })
            },
        },
    }
</script>

<style lang="scss" scoped>
    .card {
        margin-bottom: 24px;
    }
    .title {
        font-size: 20px;
        line-height: 28px;
        font-weight: 500;
        color: rgba(0, 0, 0, 0.85);
        margin: 16px 0 30px 0;
    }
</style>